// main layer
var g_backLayer=null;
var BackLayer = cc.Layer.extend({
    ctor:function () {
        this._super();
        g_backLayer=this;
        g_backLayer.retain();
        this.addBackground();
        return true;
    },
    onEnter:function () {
        this._super();
    },
    onExit : function(){
    },
    addBackground:function(){
        var filename = MainResource("background.jpg");
        var background = new cc.Sprite(filename);
        background.setPosition( cc.p(cc.winSize.width/2,cc.winSize.height/2) );
        this.addChild(background);
    }
});
AddBackLayer=function(parent){
    if(parent){
        var layer = new BackLayer();
        parent.addChild( layer,0 );
        cc.log("*** add back layer down");
    }else{
        cc.log("*** invalid parent");
    }
}
RemoveBackLayer=function(clear){
    if(g_backLayer){
        g_backLayer.removeFromParent(clear);
        cc.log("*** remove back layer down, clear: "+clear);
    }else{
        cc.log("g_backLayer is invalid");
    }
}